<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>能耗使用情况</title>
<link href="css/lyz.calendar.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery-1.5.1.js"></script>
<script src="js/lyz.calendar.min.js" type="text/javascript"></script>
<style>
body {
	font-size: 12px;
	font-family: "微软雅黑", "宋体", "Arial Narrow";
}
</style>
<script>
	$(function() {
		$("#txtBeginDate").calendar({
			controlId : "divDate", // 弹出的日期控件ID，默认: $(this).attr("id") + "Calendar"
			speed : 200, // 三种预定速度之一的字符串("slow", "normal", or "fast")或表示动画时长的毫秒数值(如：1000),默认：200
			complement : true, // 是否显示日期或年空白处的前后月的补充,默认：true
			readonly : true, // 目标对象是否设为只读，默认：true
			upperLimit : new Date(), // 日期上限，默认：NaN(不限制)
			lowerLimit : new Date("2011/1/1"), // 日期下限，默认：NaN(不限制)
			callback : function() { // 点击选择日期后的回调函数
				

			}
		});
		$("#txtEndDate").calendar();
	});

	$(document).ready(function() {
		$('#txtBeginDate').blur(function() {
			var begindate = document.getElementById('txtBeginDate').value;
			setBeginDate(begindate)
		})

		$('#txtEndDate').blur(function() {
			var enddate = document.getElementById('txtEndDate').value;
			setEndDate(enddate)
		})

		$('#select').blur(function() {
			var select = document.getElementById('select').value;
			setSelect(select)
		})
	})

	function setBeginDate(begindate) {

		$
				.ajax({
					type : 'post',
					url : '${pageContext.request.contextPath}/dayYear/setBeginDate.action',
					data : 'beginDate=' + begindate,
					success : function(data) {
						
					}
				})
	}

	function setEndDate(enddate) {

		$
				.ajax({
					type : 'post',
					url : '${pageContext.request.contextPath}/dayYear/setEndDate.action',
					data : 'endDate=' + enddate,
					success : function(data) {
						
					}
				})
	}

	function setSelect(select) {

		$
				.ajax({
					type : 'post',
					url : '${pageContext.request.contextPath}/dayYear/setSelect.action',
					data : 'select=' + select,
					success : function(data) {
						
					}
				})
	}
	
	function getPeriods(){

		$
				.ajax({
					type : 'post',
					url : '${pageContext.request.contextPath}/dayYear/setPeriods.action',
					success : function(data) {
						window.location.href="${pageContext.request.contextPath}/jsp/energy_usage.jsp";
					}
				})
	}
	
	
	function init(){
		window.location.href="${pageContext.request.contextPath}/dayYear/getList.action";
	}
</script>
</head>
<body>

	<div style="width: 800px; margin-left: 20px;">
		时间： <input id="txtBeginDate" name="txtBeginDate"
			style="width: 170px; padding: 7px 10px; border: 1px solid #ccc; margin-right: 10px;" />
		至 <input id="txtEndDate" name="txtEndDate"
			style="width: 170px; padding: 7px 10px; border: 1px solid #ccc;" />
	
		<button onclick="getPeriods()">查询</button>
		
	</div>

</body>
</html>